<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<% content_for :page_title do %><%= join_title t(:page_title, "Plugin Settings"), @plugin.name %><% end %>
<%
  js_bundle :plugins
  add_crumb(t('#crumbs.plugins', "Plugins"), plugins_path)
  add_crumb(@plugin.name)
%>

<h2><%= join_title t(:page_title, "Plugin Settings"), @plugin.name %></h2>

{{> views/settings_header}}

<div id="settings">
  <%= form_for(@plugin_setting, :url => plugin_path(@plugin.id), :html => {:method => :put}) do |f| %>
    <div style="margin-bottom: 15px; margin-top: -10px;">
      <%= f.check_box :disabled, :class => "disabled_checkbox" %>
      <%= f.label :disabled, :en => "Disable this Plugin" %>
    </div>
    <% partial = render :partial => @plugin.settings_partial, :locals => {:settings => (@plugin_setting.settings || {}).merge(params[:settings]&.to_unsafe_h || {})} %>
    <%= f.error_messages if !@error_messages_handled %>
    <div class="box tabular plugin_settings">
        <%= partial %>
    </div>
    <div class='button-container'>
      <button type="submit" class="btn save_button"><%= t '#buttons.apply', "Apply" %></button>
      <%=link_to(t(:back_to_list, "Return to plugins list"), plugins_path,:class => 'btn btn button-secondary')%>
    </div>
  <% end %>
</div>

<p></p>
